interface IUnit {
  code: string
  address: string
  mobile: string
  delFlag: number
  parentId: string
  enabled: number
  codeseq: string
  createBy: string
  system: number
  web: string
  createTime: number
  contact: string
  name: string
  id: string
  email: string
}

interface IUser {
  id: string
  username: string
  realName: string
  userType: number
  email: string
  phone: string
  gender: number
  avatar: string
  unitId: string
  enabled: number
  delFlag: null
  remark: null
  roles: Array<string>
  permissions: Array<string>
  unit: IUnit
  authorities: null
  accountNonLocked: boolean
  credentialsNonExpired: boolean
  accountNonExpired: boolean
}

interface IUnit {
  id: string
  name: string
  code: string
  codeseq: string
  contact: string
  mobile: string
  email: string
  web: string
  parentId: string
  system: number
  enabled: number
  leaderId: null
  delFlag: number
  createBy: string
  createTime: number
  updateBy: null
  updateTime: null
  address: string
}

export interface IRole {
  id: string
  roleName: string
  rolePerm: string
}

interface Permission {
  [index: number]: string
}

// 用户
export interface IUserData {
  code: string
  msg: string
  data: {
    userInfo: IUser
    permissions: Permission
    roles: IRole[]
    units: IUnit
  }
}

// 角色
interface IMeta {
  title: string
  icon: string
  noCache: boolean
  hidden: boolean
  affix: boolean
  link: string
}

export interface IParent {
  id?: string
  name?: string
  path?: string
  redirect?: string
  parentView?: string
  component?: string
  query?: null
  alwaysShow?: null
  type?: number
  meta?: IMeta
  children?: IParent[]
}

export interface IMenuData {
  code: string
  msg: string
  data: IParent[]
}
